From 8eafa79a73f81ea48b7b77d3bd4b2c310cca057c Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 8 Aug 2006 14:48:43 +0100 Subject: [PATCH] [XEN] Make multicall info explicitly PER_CPU. Also remove cacheline alignment in a few places. We leave the common timer and schedule_data structures aligned because they may be accessed randomly by remoted CPUs: at least we can contain cacheline bouncing to just the offending structures. Signed-off-by: Keir Fraser --- xen/arch/ia64/xen/hypercall.c | 2 +- xen/arch/x86/domain.c | 2 +- xen/arch/x86/time.c | 2 +- xen/common/multicall.c | 4 ++-- xen/include/xen/multicall.h | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c index 20ab2ecda3..7e9901bc86 100644 --- a/xen/arch/ia64/xen/hypercall.c +++ b/xen/arch/ia64/xen/hypercall.c @@ -335,7 +335,7 @@ ia64_hypercall (struct pt_regs *regs) unsigned long hypercall_create_continuation( unsigned int op, const char *format, ...) { - struct mc_state *mcs = &mc_state[smp_processor_id()]; + struct mc_state *mcs = &this_cpu(mc_state); struct vcpu *v = current; const char *p = format; unsigned long arg; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index cdab497e43..15baa372aa 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -797,7 +797,7 @@ void sync_vcpu_execstate(struct vcpu *v) unsigned long hypercall_create_continuation( unsigned int op, const char *format, ...) { - struct mc_state *mcs = &mc_state[smp_processor_id()]; + struct mc_state *mcs = &this_cpu(mc_state); struct cpu_user_regs *regs; const char *p = format; unsigned long arg; diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 7a8735ee02..7ead025e18 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -56,7 +56,7 @@ struct cpu_time { s_time_t stime_master_stamp; struct time_scale tsc_scale; struct timer calibration_timer; -} __cacheline_aligned; +}; static DEFINE_PER_CPU(struct cpu_time, cpu_time); diff --git a/xen/common/multicall.c b/xen/common/multicall.c index b8c3e5812f..f55926ce8c 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -14,13 +14,13 @@ #include #include -struct mc_state mc_state[NR_CPUS]; +DEFINE_PER_CPU(struct mc_state, mc_state); long do_multicall( XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls) { - struct mc_state *mcs = &mc_state[smp_processor_id()]; + struct mc_state *mcs = &this_cpu(mc_state); unsigned int i; if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) ) diff --git a/xen/include/xen/multicall.h b/xen/include/xen/multicall.h index 216e2104ee..5d8b4db1ca 100644 --- a/xen/include/xen/multicall.h +++ b/xen/include/xen/multicall.h @@ -5,6 +5,7 @@ #ifndef __XEN_MULTICALL_H__ #define __XEN_MULTICALL_H__ +#include #include #define _MCSF_in_multicall 0 @@ -14,8 +15,8 @@ struct mc_state { unsigned long flags; struct multicall_entry call; -} __cacheline_aligned; +}; -extern struct mc_state mc_state[NR_CPUS]; +DECLARE_PER_CPU(struct mc_state, mc_state); #endif /* __XEN_MULTICALL_H__ */ -- 2.30.2